import type { ProColumns } from '@ant-design/pro-table';

// 定义请求返回数据类型
export type ColumnsItem = {
  custNo: string;
  withdrawAmt: number;
  withdrawCurrency: string;
  withdrawMethod: string;
  fee: number;
  amt: number;
  exgRate: number;
  txStatus: string;
  txNo: string;
  txDte: string;
  chainWalletUrl: string;
  frenchCcyAcNo: string;
  result: string;
  operator: string;
  reason: string;
  reqNo: string;
  reqTime: string;
  status: string;
  bankName: string;
}

// 定义表头
let columnsData: ProColumns<ColumnsItem>[] = [

  {
    title: '审批状态',
    dataIndex: 'status',
    hideInTable: true,
    valueType: 'select',
    valueEnum: {
      0: { text: '待处理', status: 'Default' },
      1: { text: '批准', status: 'Success' },
      2: { text: '拒绝', status: 'Error' }
    },
  },
  {
    title: '提现客户号',
    dataIndex: 'custNo',
    hideInTable: true,
    fieldProps: {
      maxLength: 20
    },
  },
  {
    title: '客户类型',
    hideInTable: true,
    dataIndex: 'custType',
    valueType: 'select',
    valueEnum: {
      'C': { text: '商户' },
      'P': { text: '会员' },
    },
  },
  {
    title: '申请日期',
    dataIndex: 'created_at',
    hideInTable: true,
    valueType: 'dateRange',
    search: {
      transform: (value) => {
        return {
          startTime: value[0],
          endTime: value[1],
        };
      },
    },
  },

  // 上方查询，下方表头
  {
    title: '序号',
    dataIndex: 'index',
    valueType: 'indexBorder',
    width: 50,
    fixed: 'left',
  },
  {
    title: '提现客户号',
    hideInSearch: true,
    dataIndex: 'custNo',
    ellipsis: true,
    width: 160,
    fixed: 'left',
  },
  {
    title: '客户类别',
    hideInSearch: true,
    dataIndex: 'custType',
    width: 140,
    valueType: 'select',
    valueEnum: {
      'C': { text: '商户' },
      'P': { text: '会员' },
    },
  },
  {
    title: '提现金额',
    width: 120,
    hideInSearch: true,
    dataIndex: 'withdrawAmt',
  },
  {
    title: '币种',
    width: 50,
    hideInSearch: true,
    dataIndex: 'withdrawalCcy',
  },
  {
    title: '提现方式',
    hideInSearch: true,
    dataIndex: 'withdrawMethod',
    width: 140,
    valueType: 'select',
    valueEnum: {
      1: { text: '法币银行账户' },
      0: { text: '链钱包' },
    },
  },
  {
    title: '货币对',
    width: 80,
    hideInSearch: true,
    dataIndex: 'ccyPair',
  },
  {
    title: '提现汇率',
    width: 100,
    hideInSearch: true,
    dataIndex: 'exgRate',
  },
  {
    title: '申请日期',
    width: 160,
    dataIndex: 'reqTime',
    valueType: 'dateTime',
    hideInSearch: true
  },
  {
    title: '审批状态',
    dataIndex: 'status',
    hideInSearch: true,
    width: 100,
    valueEnum: {
      0: { text: '待处理', status: 'Default' },
      1: { text: '批准', status: 'Success' },
      2: { text: '拒绝', status: 'Error' }
    },
  },
  {
    title: '审批人',
    dataIndex: 'operator',
    hideInSearch: true,
    width: 100,
  },
  {
    title: '审批时间',
    width: 160,
    hideInSearch: true,
    dataIndex: 'withdrawTime',
    valueType: 'dateTime',
  },
  {
    title: '交易结果',
    hideInSearch: true,
    dataIndex: 'txStatus',
    width: 100,
    valueEnum: {
      0: { text: '成功', status: 'Success' },
      1: { text: '失败', status: 'Error' }
    },
  },
  {
    title: '交易流水号',
    hideInSearch: true,
    dataIndex: 'txNo',
    width: 170,
  },
  {
    title: '交易HASH',
    hideInSearch: true,
    dataIndex: 'txnHasH',
    width: 200,
  },
  {
    title: '操作',
    fixed: 'right',
    valueType: 'option',
    width: 100
  }
]
export default columnsData;
